<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<style>
    input, select {
        height: 30px !important;
    }

    .control-label {
        margin-bottom: 0px !important;
        line-height: 30px !important;
    }

    .bootbox .modal-dialog {
        width: 50% !important;
    }

    .editForm > div {
        min-height: 30px;
    }
    .bootbox-expand-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: -18px;
        left: -30px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_window.png") no-repeat 0 0;
    }

    .bootbox-close-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: 4px;
        left: -5px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_close.png") no-repeat 0 0;
    }

    .margin-bottom-15 {
        margin-bottom: 15px !important;
    }

</style>
<div class="row">
    <form class="editForm" style="margin-top: 15px" action="${saveUrl}" method="post" responseType="JSON" role="form"
          id="editForm_${serializeNum}"
          data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"
          data-bv-message="This value is not valid"
          data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
          data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
          data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
        <input type="hidden" name="id" value="${editEntity.id}">
        <input type="hidden" name="targetDataId" value="${targetDataId}">
        <#list studentEntityList as data>
            <#if (true && editModel=='add')||(true && editModel=='edit')>
                <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                    <div class="form-group text-align-center">
                        <label for="studentId"
                               class="col-sm-2 col-sm-offset-3 control-label no-padding-right">待分配客户：</label>
                        <div class="col-sm-3">
                            <input data-bv-message="The field is not valid" size="32" name="studentId" alt="待分配客户"
                                   id="studentId" placeholder="待分配客户" type="text" title="待分配客户" class="form-control"
                                   value="${data.name}" readonly/>
                            <span class="text"></span>
                        </div>
                    </div>
                </div>
            </#if>
        </#list>

        <#if (true && editModel=='add')||(true && editModel=='edit')>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="empAdminUserId" class="col-sm-2 col-sm-offset-3 control-label no-padding-right"><span style="color: red">*</span>分配给顾问：</label>
                    <div class="col-sm-3">
                        <select required="required" data-bv-message="请选择顾问！" name="empAdminUserId" id="empAdminUserId" class="col-xm-12 col-sm-6 col-lg-12">

                        </select>
                    </div>
                </div>
            </div>
        </#if>
        <div class="col-sm-12 margin-bottom-15">
            <div class="text-align-center">
                <button style="width: 80px;margin-right: 20px" type="submit" class="btn btn-blue" id="editFormSubmitBtn_${serializeNum}">确定</button>
                <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="取消" />
            </div>
        </div>
    </form>
</div>
<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>
    $(function(){
            ajaxRequest("sysAdminUserController/getPostListByDuty.do",{
                duty:4
            }, function (result) {
                var data=result.data;
                var arr=['<option value="">请选择</option>'];
                for (var i = 0; i< data.length; i++) {
                    arr.push('<option value="'+data[i].id+'">'+data[i].realName+'</option>')
                }
                $("#empAdminUserId").html(arr.join(''))
            },function(){
                logger.error("加载员工信息失败");
            }, "post","json")
    });
    $(".selectpicker_${serializeNum}").select2();
    $("#editForm_${serializeNum}").bind("ajaxSubmitCallback", function (event, result) {
        if (result.resCode == 200) {
            bootbox.hideAll();
            logger.info("分配成功", true);
            toView('tssStudentController/tssStudentList.do',true,'POST',{pageSize:10})
        } else {
            logger.error("分配失败");
        }
    });
</script>